
import {getToken} from '@/util/auth'

export const exportExcel = (data, url) => {
  url = url+ '?Blade-Auth=' + getToken();
  // 创建form元素
  let temp_form = document.createElement("form");
  // 设置form属性
  temp_form.action = url;
  //temp_form.target = "_blank";
  temp_form.target = "_self";
  temp_form.method = "post";
  temp_form.style.display = "none";
  // 处理需要传递的参数
  for (let x in data) {
    let opt = document.createElement("textarea");
    opt.name = x;
    opt.value = data[x];
    temp_form.appendChild(opt);
  }
  document.body.appendChild(temp_form);
  // 提交表单
  temp_form.submit();
}



